﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenNETCF.MTConnect;
using OpenNETCF.IoC;
using MachineSimulator.Interfaces;

namespace SimulatorAdapter
{
    public class Path : HostedPathBase
    {
        private string m_block;
        private string m_mode;
        private string m_execution;
        private string m_program;

        [EventDataItem(
            ItemType= DataItemType.BLOCK
            )]
        public string Block
        {
            get { return m_block; }
            set
            {
                // only publish value changes
                if (value == m_block) return;

                // store the new value
                m_block = value;

                // calling this will notify the underlying Agent engine to publish this value out the MTConnect protocol interface
                RaisePropertyChanged("Block");
            }
        }

        [EventDataItem(
            ItemType = DataItemType.CONTROLLER_MODE
            )]
        public string Mode
        {
            get { return m_mode; }
            set
            {
                // only publish value changes
                if (value == m_mode) return;

                // store the new value
                m_mode = value;

                // calling this will notify the underlying Agent engine to publish this value out the MTConnect protocol interface
                RaisePropertyChanged("Mode");
            }
        }

        [EventDataItem(
            ItemType = DataItemType.EXECUTION
            )]
        public string Execution
        {
            get { return m_execution; }
            set
            {
                // only publish value changes
                if (value == m_execution) return;

                // store the new value
                m_execution = value;

                // calling this will notify the underlying Agent engine to publish this value out the MTConnect protocol interface
                RaisePropertyChanged("Execution");
            }
        }

        [EventDataItem(
            ItemType = DataItemType.PROGRAM
            )]
        public string Program
        {
            get { return m_program; }
            set
            {
                // only publish value changes
                if (value == m_program) return;

                // store the new value
                m_program = value;

                // calling this will notify the underlying Agent engine to publish this value out the MTConnect protocol interface
                RaisePropertyChanged("Program");
            }
        }
    }
}
